package com.xxgc.springboot.controller;

import com.xxgc.springboot.entity.ConfigEntity;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: springboot
 * @description: 用户信息
 * @author: Mr.abel(ShiJiaYi)
 * @create: 2022-09-06 15:54
 **/
@Api(tags = "练习接口")
@RestController
public class UserInfoController {
    //参数少用RestFul 多的时候用对象

    //从容器中获取
    @Autowired
    private ConfigEntity configEntity;


    @GetMapping("/getConfig")
    public ConfigEntity getConfig(){
        return configEntity;
    }


    //普通的Get请求
    @GetMapping("/getInfo")
    public String getUserMessage(){
        return "获取用户信息";
    }

    //https://www.bilibili.com/video/BV1uV4y1W7Es
    //https://www.bilibili.com/video/BV1aV4y1p7AC
    //RestFul风格
   /* @GetMapping("/video/{bv}")
    public String getVideoByBv(@PathVariable String bv){
        return "我获取的BV号是"+bv;
    }*/

    //小练习：接收如下请求 13分之前完成
    //http://localhost:8080/video/BV1Qd4y1d7px
    // ?spm_id_from=333.1007.tianma.1-2-2.click
    // &vd_source=52c48d348e4fda54585937eaface2824
    @GetMapping("/video/{bv}")
    public String getVideoByBvAll(@PathVariable String bv,
                                  String spm_id_from,
                                  String vd_source){
        return "bv号："+bv+"\n"+
                "spm_id_from:"+spm_id_from+"\n"+
                "vd_source:"+vd_source;
    }





}
